});
const NMSection = GObject.registerClass({
+ Properties: {
+ 'checked': GObject.ParamSpec.boolean('checked', '', '',
+ GObject.ParamFlags.READWRITE,
+ false),
+ },
Signals: {
'activation-failed': {},
'icon-changed': {},
(item, i) => (item.visible = i < MAX_VISIBLE_NETWORKS));
}
+ _updateChecked() {
+ const [firstActive] = this._getActiveItems();
+ this.checked = !!firstActive;
+ }
+
_resortItem(item) {
const pos = this._itemSorter.upsert(item);
this._itemsSection.moveMenuItem(item, pos);
`${this} already has an item for ${key}`);
item.connectObject(
+ 'notify::is-active', () => this._updateChecked(),
'notify::name', () => this._resortItem(item),
'destroy', () => this._removeItem(key),
this);
_sync() {
this.visible = this._items.size > 0;
this._updateItemsVisibility();
+ this._updateChecked();
}
});